/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.db.DbStatus;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.message.CheckHealthResponse;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CheckHealth
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 45 */     ZimbraSoapContext lc = getZimbraSoapContext(context);
/*    */     
/* 47 */     if (needsAdminAuth(context)) {
/* 48 */       Server localServer = Provisioning.getInstance().getLocalServer();
/* 49 */       checkRight(lc, context, localServer, Rights.Admin.R_checkHealth);
/*    */     }
/*    */     
/* 52 */     boolean dir = Provisioning.getInstance().healthCheck();
/* 53 */     boolean db = DbStatus.healthCheck();
/* 54 */     boolean healthy = (dir) && (db);
/*    */     
/* 56 */     return lc.jaxbToElement(new CheckHealthResponse(healthy));
/*    */   }
/*    */   
/*    */ 
/*    */   public boolean needsAuth(Map<String, Object> context)
/*    */   {
/* 62 */     return false;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public boolean needsAdminAuth(Map<String, Object> context)
/*    */   {
/* 72 */     return !clientIsLocal(context);
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 77 */     relatedRights.add(Rights.Admin.R_checkHealth);
/* 78 */     notes.add("The " + Rights.Admin.R_checkHealth.getName() + " is needed " + "only when the client making the SOAP request is localhost.");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/CheckHealth.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */